package com.lizhen.behaviorpattern.strategypattern;

import com.lizhen.behaviorpattern.strategypattern.impl.OperationAdd;
import com.lizhen.behaviorpattern.strategypattern.impl.OperationMultiply;
import com.lizhen.behaviorpattern.strategypattern.impl.OperationSubstract;

public class StrategyPattern {
    public StrategyPattern() {
    }

    public static void main(String[] args) {
        Context context = new Context(new OperationAdd());
        System.out.println("10 + 5 = " + context.executeStrategy(10, 5));
        context = new Context(new OperationSubstract());
        System.out.println("10 - 5 = " + context.executeStrategy(10, 5));
        context = new Context(new OperationMultiply());
        System.out.println("10 * 5 = " + context.executeStrategy(10, 5));
    }
}
